<!doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" Content="text/html; charset=utf-8"/>
	<link rel="stylesheet" type="text/css" href="../css/header.css">
	<link rel="stylesheet" type="text/css" href="../css/footer.css">
	<link rel="stylesheet" type="text/css" href="../css/apply.css">
	<link rel="stylesheet" href="../res/bootstrap/css/bootstrap.min.css">
	<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.js"></script>
	<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.js"></script>
	<script src="//netdna.bootstrapcdn.com/bootstrap/2.3.2/js/bootstrap.min.js"></script>
	<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
	<script src="../myUtil.js"></script>
	<script type="text/javascript" src="../js/apply.js"></script>


</head>
<body ng-app="myModule">
<div class="container" ng-controller="MyController">
<!-- header-->
<div class="header span12">
</div>
	<!--apply_content-->
	<div style="border: solid #eee; margin: 10px 0 10px 0; padding: 10px">
		<span><H1 style="display: inline-block; margin: 0 10px 0 0">대회신청</H1>경진대회를 신청서를 작성 합니다.</span><br />
	<div style="padding: 30px">
	<!--경진대회 form-->
	
	<form class="form-horizontal" action="apply.do" method="post" enctype="multipart/form-data" onsubmit="return apply()">
		<input type="hidden" id="sel" name="contest_reg_id" ng-model="contest_reg_id" ng-value="contest_reg_id">
		<input type="hidden" id="sel" name="leader" ng-model="leader" ng-value="leader">
		<input type="hidden" id="sel" name="track_id" ng-model="track_idr" ng-value="track_id">
		<div class="control-group">
	 		<label class="control-label" for="inputTitle">대회명</label>
	   		<div class="controls">
					{{contest_reg.name+contest_reg.count+"회"}}
		  	</div>
		</div>
		<!--주제 선택-->
		<div class="control-group">
		<label class="control-label" for="inputTrack">주제</label>
	   		<div class="controls">
		   		 <select ng-model="track_id" ng-value="track_id" ng-options="item.track_id as item.track_name for item in track" ng-change="change();"></select>
		   		 <span ng-style="{'color':trackMessage.color}">{{trackMessage.message}}</span>
		  	</div>
		</div>
		<!--//주제 선택-->
		<!--팀명-->
		<div class="control-group">
			<label class="control-label" for="inputTeam">팀명</label>
			<div class="controls">
			<input ng-model="teamName" maxlength="15" ng-blur="teamNameCheck()" id="teamName" ng-keyup="teamNameCheck()" ng-keydown="teamNamecheck()"type="text" name="teamName" />
			<span ng-style="{'color':teamNameMessage.color}">{{teamNameMessage.message}}</span>
			</div>
		</div>
		<!--팀명-->
		<!--제안서-->
		<div class="control-group">
			<label class="control-label"> 제안서</label>
			<div class="controls"><input type="file" name="file"></div>
      	</div>
		<!--제안서-->
		<!--팀원선택 및 dialog실행-->
		<div class="control-group">
			<label class="control-label"> 팀원선택</label>
			<div class="controls"><a id="team_change" class="btn" ng-click="" >팀원 변경</a></div><br/>
			
      	</div>
		<!--팀원선택-->
		<!--선택된 사람-->
			<table class="check table table-condensed">
				<thead class="check"><tr><td>팀장</td><td>학과</td><td>이름</td><td>학번</td></tr></thead>
					<tbody class="check">
						<tr class="check" ng-click="leader=user.id">
							<td><input type="radio" name="lead"  ng-model="leader" ng-value="user.id"></td>
							<td>{{user.major}}</td>
							<td>{{user.name}}</td>
							<td>{{user.id}}<input type="hidden" name="user" ng-value="user.id"></td>
							
						</tr>

						<tr ng-repeat="item in current" ng-click="$parent.leader=item.id">
							<td><input type="radio" name="lead" ng-model="$parent.leader" ng-value="item.id"></td>
							<td>{{item.major}}</td>
							<td>{{item.name}}</td>
							<td>{{item.id}}<input type="hidden" name="user" ng-value="item.id"></td>
						
						</tr>
					
					</tbody>
			</table>
			<!--선택된 사람-->
		
		<br />
		<input class="btn btn-primary save1" type="submit" ng-disabled="!disabled()" value="신청하기" disabled/>
		<button class="btn" >목록보기</button> 
	</form>
	<!--경진대회 form-->
	</div>
<!--대화상자-->
<div id="우편번호대화상자" class="modal hide fade" style="max-height:45em; height:45em;" data-backdrop="static" data-keyboard="false"  tabindex="-1" >
	<div class="modal-header"><a class="team_change_ok close no" data-dismiss="modal" ng-click="init()">&times;</a><h2>팀원 검색</h2></div>
	 <div class="modal-body" style="max-height:40em;">
	<h5>현재팀원</h5>
	<div id="현재팀원">

		<div id="현재팀원_박스">
			<table class="select table table-condensed">
				<thead class="select">
					<tr>
						<th>학과</th><th>이름</th><th>학번</th><th>삭제</th>
					</tr>
				</thead>
				<tbody id="select">
					<tr id="me">
						<td>{{user.major}}</td>
						<td>{{user.name}}</td>
						<td>{{user.id}} </td>
						<td>본인</td>
					</tr>
					
					<tr ng-repeat="item in select">
						<td>{{item.major}}</td>
						<td>{{item.name}}</td>
						<td>{{item.id}}</td>
						<td>
							<button ng-if="leader!=item.id" class="btn-small btn" ng-click="removeSelect($index)">삭제</button>
							<span ng-if="leader==item.id">팀장</span>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>

	<h5 style="color:red">선택한 대회와 주제에  참여가능한 사람만 검색됩니다.</h5>
	<div class="form-horizontal">
		<select id="검색" ng-model="temp">
			<option value="name">이름</option>
			<option value="id">학번</option>
		</select>
		<input id="검색" type="text" ng-model="str" class="search-query" />
		<button class="btn search" ng-click="teamChange()">검색</button>
	</div>
	<!--로딩-->
	<div style="display:none; margin-left:13em; position:absolute;"  id="viewLoading">
		<img src="../res/img/ajax-loader.gif" width="100" height="80">
	</div>
	<!--//로딩-->

	<div id="우편번호대화상자_검색결과_박스" style="height:15em;">
		 <table class="search table table-condensed">
			<thead class="search">
				<tr><th>학과</th><th>이름</th><th>학번</th><th>선택</th></tr>
			</thead>
			<tbody id="search" style="height:12em;">
				<!-- 이부분이 ajax -->
				<tr ng-repeat="item in search">
					<td>{{item.major}}</td>
					<td>{{item.name}}</td>
					<td>{{item.id}}</td>
					<td>
						<button class="btn-small btn" ng-if="!checkSelect($index) && user.id!=item.id" ng-click="addSelect($index)">추가</button>
						<span ng-if="user.id==item.id">본인</span>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
<div class="modal-footer" style="display:block;">
	<a class="team_change_ok no btn" data-dismiss="modal" ng-click="init()">취소</a>
	<a class="team_change_ok ok btn btn-primary" data-dismiss="modal" ng-click="addCurrent()">확인</a>
</div>
<!--//대화상자-->
</div>
<!--//apply_content-->

<!--footer-->
	<div class="footer span12">

	</div>
<!--//footer-->
</div>
</div>
</body>
</html>